import { Component, OnInit, Input } from '@angular/core'
import { STColumn, STColumnTag } from '@delon/abc'
import { NzMessageService } from 'ng-zorro-antd'
import { I18NService } from '@core'
import { ActivatedRoute, Router } from '@angular/router'

import { ListBaseClass } from '@shared/classes/ListBaseClass'

const TAG: STColumnTag = {
  created: { text: '创建', color: '#585C60' },
  updated: { text: '更改', color: '#37BFB4' },
  deleted: { text: '删除', color: '#DB2E2E' },
}
@Component({
  selector: 'app-history-expand-table',
  templateUrl: './history-expand-table.component.html'
})
export class HistoryExpandTableComponent extends ListBaseClass<any, any> implements OnInit {
  @Input() data: any
  columns: STColumn[] = [
    {
      title: '用户',
      index: 'userName',
      fixed: 'left',
      className: 'text-left',
    },
    {
      title: '操作',
      index: 'status',
      className: 'text-center',
      width: '100px',
      type: 'tag',
      tag: TAG
    },
    {
      title: '内容',
      index: 'description',
    },
    {
      title: '时间',
      index: 'time',
      fixed: 'right',
      className: 'text-center',
      type: 'date',
      dateFormat: 'YYYY-MM-DD HH:mm',
    },
  ]

  constructor(
    public msg: NzMessageService,
    public i18n: I18NService,
    public route: ActivatedRoute,
    public router: Router,
  ) {
    super(msg, i18n, route, router)
  }

  ngOnInit() {
  }
}
